DXL for restoring DPA file

I am trying to restore a dpa file using dxl scripting and I am running into issues with the "restore" command.

I'm starting with a very simple script (detailed below):

ArchiveData archiveData
string filename = "test.dpa"
string message
message = get(filename, archiveData)
if (null message) {
message = restore (archiveData, "TEST PROJECT")
if (message != null) {
ack message
halt
}
}
else
ack message

When I run this script, i constantly get an error message that states "Cannot find target location".  I think this is happening because "TEST PROJECT" does not exist, however if I first create the "TEST PROJECT" project, the script throws a "duplicate project name" error. I'm not sure what I am doing wrong, but nothing seems to be working.

Also, the reason why I chose to use the ArchiveData framework is because I would like to be able to deselect/select only certain modules to be restored.

Any help will be greatly appreciated!


jay81 - Wed May 08 17:34:34 EDT 2013

Re: DXL for restoring DPA file
Tony_Goodman - Thu May 09 09:47:32 EDT 2013

Wrong function name!

You need to use restoreProject, which takes an extra string parameter for the description.

string res = restoreProject("c:/test.dpa", "New Project Name", "New Project Description")

This creates the new project in the current folder.

Re: DXL for restoring DPA file
llandale - Thu May 09 11:19:03 EDT 2013

Guess1:  Add a slash:

  • message = restore (archiveData, "/TEST PROJECT")

Guess2: You lack "C" rights to the database root folder.

-Louie

Re: DXL for restoring DPA file
jay81 - Thu May 09 16:56:00 EDT 2013

llandale - Thu May 09 11:19:03 EDT 2013

Guess1:  Add a slash:

  • message = restore (archiveData, "/TEST PROJECT")

Guess2: You lack "C" rights to the database root folder.

-Louie

Guess1 is a winner! I never thought of adding the slash as the documentation does not have an example of the usage of string restore(ArchiveData archive [,string archiveName], [bool serverArchive])

Thanks!

Re: DXL for restoring DPA file
jay81 - Thu May 09 16:57:14 EDT 2013

Tony_Goodman - Thu May 09 09:47:32 EDT 2013

Wrong function name!

You need to use restoreProject, which takes an extra string parameter for the description.

string res = restoreProject("c:/test.dpa", "New Project Name", "New Project Description")

This creates the new project in the current folder.

I can definitely restore projects directly by referencing the file name, however I was hoping to use the restore function that allows the usage of the data type ArchiveData.  This allows me to restore only portions of project, instead of every single module in the archive.

Re: DXL for restoring DPA file
G_S_Edwards - Thu Jan 11 15:59:35 EST 2018

Tony_Goodman - Thu May 09 09:47:32 EDT 2013

Wrong function name!

You need to use restoreProject, which takes an extra string parameter for the description.

string res = restoreProject("c:/test.dpa", "New Project Name", "New Project Description")

This creates the new project in the current folder.

Hey Tony,

Would you know if a dpa (project archive) created in server version 9.6 could be restored in server version 9.3?

-Graham

Re: DXL for restoring DPA file
PekkaMakinen - Fri Jan 12 00:48:46 EST 2018

G_S_Edwards - Thu Jan 11 15:59:35 EST 2018

Hey Tony,

Would you know if a dpa (project archive) created in server version 9.6 could be restored in server version 9.3?

-Graham

Yes, all 9.x DPAs work across all DOORS 9.x versions.